{extend name="admin@index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <input name="id" type="hidden" value="{$data.id}">

    <div class="layui-form-item">
        <label class="layui-form-label">商家名称</label>
        <div class="layui-input-block">
            <input type="text" name="row[shop_name]" autocomplete="off" placeholder="商家名称" class="layui-input"
                   value="{$data.shop_name}" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">商家联系人</label>
        <div class="layui-input-block">
            <input type="text" name="row[people]" autocomplete="off" placeholder="商家联系人" class="layui-input"
                   value="{$data.people}" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">联系电话</label>
        <div class="layui-input-block">
            <input type="text" name="row[phone]" autocomplete="off" placeholder="联系电话" class="layui-input"
                   value="{$data.phone}" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">最低提现金额</label>
        <div class="layui-input-block">
            <input  value="{$data.min_tx}" type="text" name="row[min_tx]" lay-verify="required|Number" autocomplete="off" placeholder="最低提现金额"
                    class="layui-input">
        </div>
    </div>

<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">省</label>-->
<!--        <div class="layui-input-block">-->
<!--            <select name="row[province]" lay-verify="required" lay-filter="ccc62">-->
<!--                <option value="">请选择省</option>-->
<!--                {volist name="proviec" id="vo"}-->
<!--                &lt;!&ndash;                <option  value="{$key.id}"  name="row[operate_type]">{$key.name}</option>&ndash;&gt;-->
<!--                <option value="{$vo.name}" <?php if( $vo['name'] == $data['province']){ ?> selected <?php }?>>{$vo.name}</option>-->
<!--                {/volist}-->
<!--            </select>-->
<!--        </div>-->
<!--    </div>-->

<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">市</label>-->
<!--        <div class="layui-input-block">-->
<!--            <select id="c-city" name="row[city]" lay-verify="" lay-filter="c-city">-->
<!--                <option value="">请选择市</option>-->
<!--                {volist name="city_list" id="vo"}-->
<!--                <option value="{$vo.name}" <?php if( $vo['name'] == $data['city']){ ?> selected <?php }?>>{$vo.name}</option>-->
<!--                {/volist}-->
<!--            </select>-->
<!--        </div>-->
<!--    </div>-->

<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">区</label>-->
<!--        <div class="layui-input-block">-->
<!--            <select id="c-city2" name="row[area]" lay-verify="" lay-filter="c-city2">-->
<!--                <option value="">请选择区</option>-->
<!--                {volist name="area_list" id="vo"}-->
<!--                <option value="{$vo.name}" <?php if( $vo['name'] == $data['area']){ ?> selected <?php }?>>{$vo.name}</option>-->
<!--                {/volist}-->
<!--            </select>-->
<!--        </div>-->
<!--    </div>-->


    <div class="layui-form-item">
        <label class="layui-form-label">详情地址</label>
        <div class="layui-input-block">
            <input type="text" name="row[address]" autocomplete="off" placeholder="详情地址:xx路xx号" class="layui-input"
                   value="{$data.address}">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label" >营业资质</label>
        <div class="layui-input-block">
            <ul class="layui-row list-inline plupload-preview" id="p-pic">
                {volist name="data_img" id="vo"}
                <li class="file-item thumbnail"><a href="javascript:;">
                    <img data-image=""
                         onerror="this.src='/admin/ajax/icon?suffix=png';this.onerror=null;"
                         data-original="{$vo.img}"
                         src="{$vo.img}">
                </a>
                </li>
                {/volist}
            </ul>
        </div>
    </div>

    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit>提交</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['yznForm', 'laydate','form'], function () {
        var yznForm = layui.yznForm,
            laydate = layui.laydate;
        var form = layui.form;
        yznForm.bindevent($("form.layui-form"));
        laydate.render({
            elem: '#ID-laydate'
        });
        form.on('select(ccc6)', function (data) {
            console.log(data.value);
            if (data.value == 3) {
                $(".c5").show();
            } else{
                $(".c5").hide();
            }
            form.render();
        });

        form.on('select(ccc62)', function (data) {
            console.log(data.value);
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {
                        $("#c-city").empty();
                        var str = "<option value>请选择市</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city").append(str);

                        $("#c-city2").empty();
                        var str2 = "<option value>请选择区</option>";
                        $("#c-city2").append(str2);

                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

        form.on('select(c-city)', function (data) {
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {

                        $("#c-city2").empty();
                        var str = "<option value>请选择区</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city2").append(str);
                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

    });
</script>
{/block}